package com.yn.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum UserIdentityEnum {

    ORDINARY_USER(0, "普通用户"),
    FLEET_ENTRY_PERSONNEL(1, "车队入驻人员"),
    ESCORT_PERSONNEL(2, "陪护人员"),
    ;


    private Integer code;

    private String name;

    public static UserIdentityEnum getByCode(Integer code) {
        if(null == code) {
            return null;
        }
        for(UserIdentityEnum identityEnum : UserIdentityEnum.values()) {
            if(identityEnum.getCode() == code) {
                return identityEnum;
            }
        }
        return null;
    }

}
